namespace CollegeReviewMVC.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class First : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.Colleges",
                c => new
                    {
                        CollegeId = c.Int(nullable: false, identity: true),
                        CollegeName = c.String(),
                        College_CollegeId = c.Int(),
                    })
                .PrimaryKey(t => t.CollegeId)
                .ForeignKey("dbo.Colleges", t => t.College_CollegeId)
                .Index(t => t.College_CollegeId);
            
            CreateTable(
                "dbo.Reviews",
                c => new
                    {
                        UserId = c.Int(nullable: false, identity: true),
                        ReviewPost = c.String(),
                        DatePosted = c.DateTime(nullable: false),
                        CollegeId = c.Int(nullable: false),
                    })
                .PrimaryKey(t => t.UserId)
                .ForeignKey("dbo.Colleges", t => t.CollegeId, cascadeDelete: true)
                .Index(t => t.CollegeId);
            
        }
        
        public override void Down()
        {
            DropForeignKey("dbo.Reviews", "CollegeId", "dbo.Colleges");
            DropForeignKey("dbo.Colleges", "College_CollegeId", "dbo.Colleges");
            DropIndex("dbo.Reviews", new[] { "CollegeId" });
            DropIndex("dbo.Colleges", new[] { "College_CollegeId" });
            DropTable("dbo.Reviews");
            DropTable("dbo.Colleges");
        }
    }
}
